package org.example.config;

import javax.servlet.http.HttpSession;

public class SessionManager {
    private static HttpSession session;

    public static void setSession(HttpSession session) {
        SessionManager.session = session;
    }

    public static HttpSession getSession() {
        return session;
    }

    public static void setLoginInfo(String username,int user_id) {
        session.setAttribute("username", username);
        session.setAttribute("user_id", user_id);
    }

    public static String getUsername() {
        return (String) session.getAttribute("username");
    }
    public static int getUserId() {
        return (int)session.getAttribute("user_id");
    }
}
